<template>
	<div style="background-color: #F7F7F7;width: 100vw;height: 100vh;display: flex;flex-direction: column">
		<u-parse class="itemContent" :content="htmlValue" :lazyLoad="true"></u-parse>
	</div>
</template>
	
<script>
	import { ProtocolType } from '../../../utils/auth';
	import protocol from '@/api/protocol.js'
	export default{
		data(){
			return{
				StatusBar: this.StatusBar,
				CustomBar: 0,//this.$statusBarHeight
				TopHeight:0,
				protocolType:'',
				htmlValue:''
			}
		},
		mounted() {
			uni.getSystemInfo({success: (e) => {
				this.StatusBar = e.statusBarHeight;
				let custom = wx.getMenuButtonBoundingClientRect();
				this.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
				this.TopHeight = this.CustomBar+100;//this.StatusBar+this.CustomBar;
			}})
		},
		onShow() {
			
		},
		onLoad(options) {
			if (options.protocolType) {
				this.protocolType = options.protocolType
				if (this.protocolType == ProtocolType.PRIVACY_POLICY) {
					uni.setNavigationBarTitle({
						title: '隐私政策'
					})
				}
				if (this.protocolType == ProtocolType.USER_AGREEMENT) {
					uni.setNavigationBarTitle({
						title: '用户协议'
					})
				}
				this.getPrivacyPolicyRequest()
			}
		},
		methods:{
			getPrivacyPolicyRequest(){
				protocol.getPrivacyPolicy({privacyPolicyType: this.protocolType}).then(res =>{
					this.htmlValue = res.content
				}).catch(error =>{
					
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.itemContent{
	padding: 12px 12px 12px 12px;
}
table, td, th {
  border-color: #ddd;
  border-width: 1px;
  border-style: solid;
}
</style>